#pragma once

#include <osg/Node>
#include <string>
#include <vector>
#include "../InsConfig.h"

class ScenePointCloud
{
public:
	enum DataType
	{
		Auto,
		XYZ,
		XYZRGB,
		XYZRGBC,
		XYZRGBCI
	};
	class PointData
	{
	public:
		osg::Vec3 xyz;
		osg::Vec3 color;
		int seg_class;
		int instance_id;
	};
	class PointsVector
	{
	public:
		PointsVector();
		osg::ref_ptr<osg::Vec3Array>   xyzvec;
		// Color array in osg format
		osg::ref_ptr<osg::Vec4Array>   colorvec;

		std::vector<int> seg_class_vec;
		std::vector<int> instance_id_vec;
	};
public:
	ScenePointCloud();
	osg::Node* getNode(std::string path,InsConfig* cfg = 0);
	osg::Node* loadTxtFile(std::string path,std::string split_char = ",", ScenePointCloud::DataType dt = ScenePointCloud::DataType::Auto);

protected:
	osg::Node* _points2Node(const PointsVector& points);
	float _pointSize = -1;
	bool _maskFlag = false;
	std::map<int, int> _label_class;
};

